import React from 'react';
import { Empty, Table } from 'antd';
import FormContainer from './FormContainer';

/**
 * 员工档案 - 在职信息 - 岗位兼任
 */
const DutySection = ({ formData }) => {
    const columns = [
        {
            title: '岗位名称',
            dataIndex: 'dutyAlias',
            key: 'dutyAlias'
        },
        {
            title: '所在机构',
            dataIndex: 'organizationName',
            key: 'organizationName'
        },
        {
            title: '任职类型',
            dataIndex: 'dutyType',
            key: 'dutyType',
            render: text => ['兼任', '主岗'][text]
        }
    ];

    // render
    return (
        <FormContainer title="岗位兼任" hasEditAuth={false}>
            {() =>
                formData?.length ? (
                    <Table
                        columns={columns}
                        dataSource={formData}
                        rowKey="organizationName"
                        scroll={{ y: 1080 }}
                        pagination={false}
                    />
                ) : (
                    <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
                )
            }
        </FormContainer>
    );
};

export default DutySection;
